﻿/**
 * particles
 *
 * @author		Duarte Peixinho
 * @version		1.0
 */


package com.duartepeixinho.particles.core
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	
	public class Particle
	{		
		//position vars
		private var _x:Number;
		private var _y:Number;
		private var _z:Number;
		
		private var _xInit:Number;
		private var _yInit:Number;
		private var _zInit:Number;
		
		//velocity vars
		public var xv:Number;
		public var yv:Number;
		
		//acceleration vars
		public var ax:Number;
		public var ay:Number;
		
		//time vars
		public var tx:Number;
		public var ty:Number;
		
		//easing vars
		public var easing:Number;
		public var spring:Number;
		public var friction:Number;
		
		private var _bitmapdata:BitmapData;
		
		/**
		 * 
		 * @param	bitmapdata		BitmapData		pixel bitmapdata
		 * @param	x				Number			x poistion on sprite
		 * @param	y				Number			y position on sprite
		 */
		public function Particle(bitmapdata:BitmapData, x:Number, y:Number, z:Number = 0, xInit:Number = 0, yInit:Number = 0, zInit:Number = 0):void 
		{
			_x = x;
			_y = y;
			_z = z;
			_xInit = xInit;
			_yInit = yInit;
			_zInit = zInit;
			_bitmapdata = bitmapdata;
		}
		/**
		 * show
		 * @return					Bitmap		returns the pixel image
		 */
		public function show():Bitmap {	
			return new Bitmap(_bitmapdata);
		}
		
		/**
		 * getX						
		 * @return					Number		returns the x position in the Sprite
		 */
		public function get x():Number {
			return _x;
		}
		/**
		 * getY
		 * @return					Number		returns the y position in the Sprite
		 */
		public function get y():Number {
			return _y;
		}
		
		public function get xInit():Number {
			return _xInit;
		}
		public function get yInit():Number {
			return _yInit;
		}
		public function set xInit(x:Number):void {
			_xInit = x;
		}
		public function set yInit(y:Number):void {
			_yInit = y;
		}
		/**
		 * Set X
		 * @param	Number	x	X value
		 */
		public function set x(x:Number):void {
			_x = x;
		}
		
		/**
		 * Set Y
		 * @param	Number	y	Y value
		 */
		public function set y(y:Number):void {
			_y = y;
		}		
	}
	
}